<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title></title>
    <link rel="stylesheet" href="../ucs.css">
    <link rel="stylesheet" href="../font/iconfont.css">
    <link rel="stylesheet" href="../demo.css">
</head>
<body>
    <div id="main"></div>
    <script type="text/javascript" src="../../dist/libs/u-eventhub.js"></script>
    <script type="text/javascript" src="../../dist/libs/engine.js"></script>
    <script type="text/javascript" src="../../dist/ucsmy-ui.js"></script>

    <script type="text/javascript">
        //确认投资金额
        var inputNumDM = new UDM({
            value:{
                "FinanceDetail":
                {
                    "FinancingId":"00ccff26-9343-40ef-b3da-9bf92068349e",
                    "ProjectName":"乐盈【201608110021】",
                    "PrjectType":0,
                    "IsExclusivePublic":false,
                    "ProjectStatus":5,
                    "Duration":95,
                    "Interest":8.60,
                    "MinInvestPartsCount":0,
                    "MaxInvestPartsCount":10000,
                    "RemainPartsCount":0,
                    "EachPartAmount":1.00,
                    "AppendBuyAmount":1000.00,
                    "RepayBegin":"2016-11-30 00:00:00",
                    "MaxLimitCount":20000.00,
                    "TotalMaxLimitCount":500000.00,
                    "ReFree":"13608040001",
                    "PartsCount":0,
                    "InvestPromptText":"您在此项目的剩余可投金额为 448,000.00元"
                },
                "Status":1
            }
        });
        //回款账户
        var PayBankCardsDM = new UDM({
            value:{
                Status:1,       //绑卡状态 0：失败，1：成功，2：未绑卡
                PrjectType:1,        //0：普通项目，1：专属项目
                SelectIndex:1,      //默认选中的银行卡
                StayMobile:"186****2323",
                UserBankAccountId:"",
                BankAccountList:[
                    {
                        "UserBankAccountId": "b8f6b16f482741258a12cca9dc529059",
                        "AccountNoHide": " **** **** **** 6610",
                        "AccountNoShortHide": "**** **** 6610",
                        "AccountName": "??**",
                        "BankCardLogo": "bank-cmbc",
                        "BankCardType": 0,
                        "BankCode": "305",
                        "BankIconCss": "bank-cmbc",
                        "BankIconUrl": "http://ttmy.ucsmy.com//Content/images/bankLogo/bank_icon_cmbc.png",
                        "BankName": "?й?????????",
                        "Brdnbr": null,
                        "Type": "????"
                    },
                    {
                        "UserBankAccountId": "dd4a2bb44a9742b9bc839c35436e9279",
                        "AccountNoHide": " **** **** **** 2210",
                        "AccountNoShortHide": "**** **** 2210",
                        "AccountName": "??**",
                        "BankCardLogo": "bank-ecitic",
                        "BankCardType": 0,
                        "BankCode": "302",
                        "BankIconCss": "bank-ecitic",
                        "BankIconUrl": "http://ttmy.ucsmy.com//Content/images/bankLogo/bank_icon_ecitic.png",
                        "BankName": "????????",
                        "Brdnbr": null,
                        "Type": "????"
                    },
                    {
                        "UserBankAccountId": "5a2702e0a0084bbabd1f73070b9a0c1f",
                        "AccountNoHide": " **** **** **** 3310",
                        "AccountNoShortHide": "**** **** 3310",
                        "AccountName": "??**",
                        "BankCardLogo": "bank-cebbank",
                        "BankCardType": 0,
                        "BankCode": "303",
                        "BankIconCss": "bank-cebbank",
                        "BankIconUrl": "http://ttmy.ucsmy.com//Content/images/bankLogo/bank_icon_cebbank.png",
                        "BankName": "?й????????",
                        "Brdnbr": null,
                        "Type": "????"
                    },
                    {
                        "UserBankAccountId": "c170a4830f88470b9e5c3bdcc35512b8",
                        "AccountNoHide": " **** **** **** 9910",
                        "AccountNoShortHide": "**** **** 9910",
                        "AccountName": "??**",
                        "BankCardLogo": "bank-ccb",
                        "BankCardType": 0,
                        "BankCode": "105",
                        "BankIconCss": "bank-ccb",
                        "BankIconUrl": "http://ttmy.ucsmy.com//Content/images/bankLogo/bank_icon_ccb.png",
                        "BankName": "?й?????????",
                        "Brdnbr": null,
                        "Type": "????"
                    }
                ]
            }
        });
        //身份信息
        var userInfoDM = new UDM({
            value:{
                realName:"黎**",
                IDcard:"441111*******02",
                StayMobile:{
                    value:111,
                    className:"222"
                }
            }
        });
        //专属码
        var ExclusiveNumDM = new UDM({
            placeholder:"请输入项目专属识别码",
            validator:[
                {type:"require",msg:"该项目为专属项目，请输入项目专属识别码"}
            ]
        });
        //支付密码
        var BussinessPwdDM = new UDM({
            placeholder:"请输入支付密码",
            validator:[
                {type:"require",msg:"支付密码不能为空"}
            ]
        });
        //推荐码
        var ReFreeDM = new UDM({
            placeholder:"请输入推荐码",
            validator:[
                {
                    type:"fn",
                    fn:function(v){
                        console.log(v)
                    },
                    msg:"推荐码不存在，请重新输入"
                }
            ]
        });
        //同意协议
        var checkboxDM = new UDM({
            checked:true,
            onClick:function(v){
                console.log(v)
            }
        });
        //确认购买按钮
        var btnDM = new UDM({
            onClick:function(){
                console.log(PayBankCardsDM.getValue().BankCardId);
                var result = {
                    orderType:1,
                    ProjectName:"企贷项目【20160503】",
                    OrderAmount:10000.00,
                    InterestAmount:3.12,
                    Interest:5000.00,
                    Duration:30,
                    RepayBegin:"2016-10-06",
                    ErrorTips:"对不起，该订单交易处理失败，请您稍后再试或者咨询：0816-2373017",
                    retry:function () {
                        UEventHub.emit('showResult',false);
                    }
                };
                PageDM.resultDate.setValue(result);
                UEventHub.emit('showResult',true,result);

                console.log(PageDM.resultDate)
            }
        });

        var URLDM = new UDM({
            home:"../demoIndex/index.html",     //首页
            account:"../demoMyAccount/index.html", //账户中心
            invest:"../demoInvestList/index.html",  //我要投资
            addCard:"../demoMyBankCard/index.html", //添加银行卡
            agreement:"协议链接",    //协议链接
            retry:"../demoConfirmPay/index.html"    //返回重试
        });
        var resultDateDM = new UDM({
            value:{
                orderType:1,
                ProjectName:"企贷项目【20160503】",
                OrderAmount:100000.00,
                Interest:5000.00,
                Duration:30,
                InterestAmount:"5600.35",
                RepayBegin:"2016-10-06",
                ErrorTips:"对不起，该订单交易处理失败，请您稍后再试或者咨询：0816-2373017",
                retry:function () {
                    UEventHub.emit('showResult',false)
                }
            }
        });
        var ajaxFn = function(){
            //确认投资金额
            inputNumDM.setValue({
                "FinanceDetail":
                    {
                        "FinancingId":"00ccff26-9343-40ef-b3da-9bf92068349e",
                        "ProjectName":"乐盈【201608110021】",
                        "PrjectType":0,
                        "IsExclusivePublic":false,
                        "ProjectStatus":5,
                        "Duration":95,
                        "Interest":8.60,
                        "MinInvestPartsCount":1,
                        "MaxInvestPartsCount":10,
                        "RemainPartsCount":0,
                        "EachPartAmount":1000.00,
                        "AppendBuyAmount":1000.00,
                        "RepayBegin":"2016-11-30 00:00:00",
                        "MaxLimitCount":20000.00,
                        "TotalMaxLimitCount":500000.00,
                        "ReFree":"13608040001",
                        "PartsCount":3000,
                        "InvestPromptText":"您在此项目的剩余可投金额为 448,000.00元"
                    },
                    "Status":1
                }
            );

            //回款账户
            PayBankCardsDM.setValue({
                Status:1,       //绑卡状态 0：失败，1：成功，2：未绑卡
                PrjectType:1,        //0：普通项目，1：专属项目
                SelectIndex:3,      //默认选中的银行卡
                StayMobile:"186****2323",
                BankAccountList:[
                    {
                        "UserBankAccountId": "b8f6b16f482741258a12cca9dc529059",
                        "AccountNoHide": " **** **** **** 6610",
                        "AccountNoShortHide": "**** **** 6610",
                        "AccountName": "??**",
                        "BankCardLogo": "bank-cmbc",
                        "BankCardType": 0,
                        "BankCode": "305",
                        "BankIconCss": "bank-cmbc",
                        "BankIconUrl": "http://ttmy.ucsmy.com//Content/images/bankLogo/bank_icon_cmbc.png",
                        "BankName": "?й?????????",
                        "Brdnbr": null,
                        "Type": "????"
                    },
                    {
                        "UserBankAccountId": "dd4a2bb44a9742b9bc839c35436e9279",
                        "AccountNoHide": " **** **** **** 2210",
                        "AccountNoShortHide": "**** **** 2210",
                        "AccountName": "??**",
                        "BankCardLogo": "bank-ecitic",
                        "BankCardType": 0,
                        "BankCode": "302",
                        "BankIconCss": "bank-ecitic",
                        "BankIconUrl": "http://ttmy.ucsmy.com//Content/images/bankLogo/bank_icon_ecitic.png",
                        "BankName": "????????",
                        "Brdnbr": null,
                        "Type": "????"
                    },
                    {
                        "UserBankAccountId": "5a2702e0a0084bbabd1f73070b9a0c1f",
                        "AccountNoHide": " **** **** **** 3310",
                        "AccountNoShortHide": "**** **** 3310",
                        "AccountName": "??**",
                        "BankCardLogo": "bank-cebbank",
                        "BankCardType": 0,
                        "BankCode": "303",
                        "BankIconCss": "bank-cebbank",
                        "BankIconUrl": "http://ttmy.ucsmy.com//Content/images/bankLogo/bank_icon_cebbank.png",
                        "BankName": "?й????????",
                        "Brdnbr": null,
                        "Type": "????"
                    },
                    {
                        "UserBankAccountId": "c170a4830f88470b9e5c3bdcc35512b8",
                        "AccountNoHide": " **** **** **** 9910",
                        "AccountNoShortHide": "**** **** 9910",
                        "AccountName": "??**",
                        "BankCardLogo": "bank-ccb",
                        "BankCardType": 0,
                        "BankCode": "105",
                        "BankIconCss": "bank-ccb",
                        "BankIconUrl": "http://ttmy.ucsmy.com//Content/images/bankLogo/bank_icon_ccb.png",
                        "BankName": "?й?????????",
                        "Brdnbr": null,
                        "Type": "????"
                    }
                ]
            });
            //身份信息
            userInfoDM.setValue({
                realName:"林**"
            });
        };

        UEventHub.on("pageLoad",function(){
            ajaxFn();
        });
        var PageDM = {
            URL:URLDM,
            inputNum:inputNumDM,
            PayBankCards:PayBankCardsDM,
            userInfo:userInfoDM,
            ExclusiveNum:ExclusiveNumDM,
            BussinessPwd:BussinessPwdDM,
            ReFree:ReFreeDM,
            checkbox:checkboxDM,
            btn:btnDM,
            resultDate:resultDateDM
        };
    </script>
</body>
</html>